<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
<head>
<jsp:include page="common_header.jsp" flush="true"></jsp:include>
<title>添加异常日志 - 异常日志管理</title>
</head>
<body>
<article class="page-container">
	<form class="form form-horizontal" id="form-loggingEvent-add">
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>eventId：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入eventId" name="eventId">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>timestmp：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入timestmp" name="timestmp">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>loggerName：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入loggerName" name="loggerName">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>levelString：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入levelString" name="levelString">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>threadName：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入threadName" name="threadName">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>referenceFlag：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入referenceFlag" name="referenceFlag">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>arg0：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea rows="" cols="" name="arg0" class="textarea"></textarea>
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>arg1：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea rows="" cols="" name="arg1" class="textarea"></textarea>
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>arg2：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea rows="" cols="" name="arg2" class="textarea"></textarea>
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>arg3：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea rows="" cols="" name="arg3" class="textarea"></textarea>
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>callerFilename：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入callerFilename" name="callerFilename">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>callerClass：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入callerClass" name="callerClass">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>callerMethod：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入callerMethod" name="callerMethod">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>callerLine：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<input type="text" class="input-text" placeholder="请输入callerLine" name="callerLine">
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>formattedMessage：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea rows="" cols="" name="formattedMessage" class="textarea"></textarea>
		</div>
	</div>
	<div class="row cl">
		
    	<label class="form-label col-xs-4 col-sm-3"><span class="c-red">*</span>异常堆栈：</label>
		<div class="formControls col-xs-8 col-sm-9">
			<textarea rows="" cols="" name="traceLine" id="traceLine" class="textarea radius"></textarea>
		</div>
	</div>
	
	<div class="row cl">
		<div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
		</div>
	</div>
	</form>
</article>

<jsp:include page="_footer.jsp" flush="true"></jsp:include>
<script type="text/javascript" src="${path }/lib/My97DatePicker/4.8/WdatePicker.js"></script>
<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript">
var loggingEventId;
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	
	$('#form-loggingEvent-add input').each(function(){
		$(this).attr("readonly", "readonly");
	});
	$('#form-loggingEvent-add textarea').each(function(){
		$(this).attr("readonly", "readonly");
	});
	
// 	$("#form-loggingEvent-add").validate({
// 		rules:{
//         	eventId:{
// 				required:true
// 			},
//         	timestmp:{
// 				required:true
// 			},
//         	loggerName:{
// 				required:true
// 			},
//         	levelString:{
// 				required:true
// 			},
//         	threadName:{
// 				required:true
// 			},
//         	referenceFlag:{
// 				required:true
// 			},
//         	arg0:{
// 				required:true
// 			},
//         	arg1:{
// 				required:true
// 			},
//         	arg2:{
// 				required:true
// 			},
//         	arg3:{
// 				required:true
// 			},
//         	callerFilename:{
// 				required:true
// 			},
//         	callerClass:{
// 				required:true
// 			},
//         	callerMethod:{
// 				required:true
// 			},
//         	callerLine:{
// 				required:true
// 			},
//         	formattedMessage:{
// 				required:true
// 			}
// 		},
// 		onkeyup:false,
// 		success:"valid",
// 		submitHandler:function(form){
// 			addOrUpdateLoggingEvent();
// 		}
// 	});
});

function addOrUpdateLoggingEvent(){
	var url = "${path}/loggingEvent/add.do";
	var type = '添加';
	var formData = $('#form-loggingEvent-add').serialize();
	if (loggingEventId) {
		url = "${path}/loggingEvent/update.do";
		type = '修改';
		formData += '&id='+loggingEventId;
	}
	jajax({
		url: url,
		data: formData, 
		type: "POST",
		success: function(data, textStatus){
			layer.msg(type+'成功!',{icon:1,time:1000});
			setTimeout(function(){
				var index = parent.layer.getFrameIndex(window.name);
				parent.refresh(index);
			}, 1500);
		}
	});	
	
}

function fillData(id){
	loggingEventId = id;
	jajax({
		url: "${path}/loggingEvent/detail.do",
		data: 'id='+id, 
		success: function(data, textStatus){
			var obj = data.data;
			fillFormByName('form-loggingEvent-add', obj);
			$('#traceLine').val($('#traceLine').val().replace(/,,,/g,'\n'));
		}
	});
}
</script> 
</body>
</html>
